package com.test.common.entity.perf.inner;

import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;

@Data
public class TransactionMessageEntity {

	private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");

	private String label;
	private long timeStamp;
	private int successCount;
	private int failCount;
	private int qps;
	private int threads;
	private double avgDealy;
	private double level_1_Dealy;
	private double level_2_Dealy;
	private double level_3_Dealy;
	private double maxDealy;
	private double minDealy;
	private long sendBytes;
	private long receiveByte;

	public void addToMap(HashMap<String, Object> map) {

		map.put("timeStamp", format.format(new Date(this.timeStamp)));
//		map.put("timeStamp", this.timeStamp);
		map.put(this.label + "_qps", this.qps);
		map.put(this.label + "_threads", this.threads);
		map.put(this.label + "_avgDealy", this.avgDealy);
		map.put(this.label + "_50%_Dealy", this.level_1_Dealy);
		map.put(this.label + "_90%_Dealy", this.level_2_Dealy);
		map.put(this.label + "_99%_Dealy", this.level_3_Dealy);
		map.put(this.label + "_maxDealy", this.maxDealy);
		map.put(this.label + "_minDealy", this.minDealy);
		map.put(this.label + "_sendBytes", this.sendBytes);
		map.put(this.label + "_receiveByte", this.receiveByte);
	}
}